<!--  -->
<template>
  <div class="conten">
    <div class="guide"  v-if="guideStatus">
      <img class="guide-img" src="https://jinlin-airobot.oss-cn-shenzhen.aliyuncs.com/host/app_static/curriculum/guide.png">
    </div>
    <!-- 提示警告内容文字 -->
    <div v-if="!isiOS && !guideStatus" class="login-hint-box">
      <div class="hint-downlod">
        <div class="login-img"><img class="login" src="https://jinlin-airobot.oss-cn-shenzhen.aliyuncs.com/host/app_static/addwx/logo.png"/></div>
        <div class="conter">部分可能因为本身手机的浏览器原因会提示有风险。不用担心！你下载的就是正版的<text style="font-weight: bold;font-size: 4.267vw;">《大爆炸思维》</text></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},

  data() {
    return {
      pathUrl:'',
      parameter: {
        ver:'',
        rsid:'',
        radid:'',
        platform: ''
      },
      guideStatus: false,
      isAndroid:'',
      isiOS:''
    }
  },

  computed: {},
  created() {
    this.pathUrl = window.location.href.split('?')[1]
  //  this.parameter.platform = this.$route.query.platform
  //  this.parameter.ver = this.$route.query.ver
  //  this.parameter.rsid = this.$route.query.rsid
  //  this.parameter.radid = this.$route.query.radid
  },
  mounted() {
    this.promptlyGet()
  },

  methods: {
    // 下载app
    promptlyGet() {
      if (this.isWechat()) {
          this.guideStatus = true
      }else{
        let androidPathUrl = 'https://openapi.jinlinjishu.com/blob/download/dbz100-app?'+this.pathUrl
          let u = navigator.userAgent
          this.isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1
          this.isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
          if(this.isiOS){ 
            window.location.href = 'https://apps.apple.com/cn/app/%E5%A4%A7%E7%88%86%E7%82%B8%E6%80%9D%E7%BB%B4/id1601003988'
          }else if(this.isAndroid) {
            window.location.href = androidPathUrl
          }else{
             window.location.href = androidPathUrl
          }
        }
      },
    //判断是否在微信中    
    isWechat() {  
      let ua = window.navigator.userAgent.toLowerCase()
      if (ua.match(/micromessenger/i) == 'micromessenger') { 
        return true;
      } else {  
        return false;
      }  
    }, 
  }
}

</script>
<style lang='scss' scoped>
  .guide{
    margin: auto;
    margin-top: 13.333vw;
    width: 90%;
    height: 90vh;
    .guide-img{
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
     
    }
  }
    .login-hint-box{
    padding-top: 20%;
    height: 100vh;
    background: #B1B1B1;
    .hint-downlod{
      width: 90.667vw;
      height: 26.667vw;
      background: #E7F8FF;
      border-radius: 2.667vw;
      margin: auto;
      padding: 5.333vw;
      display: flex;
      align-items: center;
      .login-img{
        width: 16vw;
        height: 16vw;
        .login{
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .conter{
        width: 75%;
        margin-left: 2.667vw;
        font-size: 4vw;
        color: red;
      }
    }
  }
</style>
